<?php
 
	$lot=$_GET["lot"];
	$dbName = "sqlsrv:Server=172.31.3.9,1433;Database=emc3030";   //这里是服务器IP地址和数据库名，端口不是默认的话记得改一下
	$dbUser = "sa";    //用户名
	$dbPassword = "TDled2017";    //登陆密码
	$db = new PDO($dbName, $dbUser, $dbPassword);   
	$sql = "select id  from sl_bag where  ctype='1' and clotno='".$lot."'";//17620T4003-7250613 菲利浦
	$res = $db->query($sql);
	$bid="";
	while ($row = $res->fetch()){
	$bid=$row['id'];
	}
	$sql = "select clotno  from sl_bags where  id= '".$bid."'";//17620T4003-7250613
	$res2 = $db->query($sql);
	$rdisk="";
	$row = null;
	while ($row = $res2->fetch()){
	$rdisk.= $row['clotno'].",";
	}
	IF (strlen($rdisk)>0){
		
		 print_r($rdisk);
		 
	 
		$res = null;
		$res2 = null;
		$db = null;
	}ELSE{
		//ECHO "NULL";
		$res = null;
		$db = null;
		$dbName_2 = "sqlsrv:Server=172.31.3.9,1433;Database=UFDATA_001_2017";   //这里是服务器IP地址和数据库名，端口不是默认的话记得改一下
		$db_2 = new PDO($dbName_2, $dbUser, $dbPassword);   
		$sql_2 = "select clotno from dbo.ldx_seoulInsideMX where InsideboxNO = '".$lot."'";//18119T400R-7250715 菲利浦

		$res_2 = $db_2->query($sql_2);

		$rdisk_2="";
		$row_2 = null;
		while ($row_2 = $res_2->fetch()){
		$rdisk_2.= $row_2['clotno'].",";
		}
		print_r($rdisk_2);

		$db_2 = null;
		$res_2 = null;}